﻿@model OA.Model.Config.SystemConfig
@{
    ViewBag.Title = "系统参数设置";
    }
@section head{
   <script type="text/javascript">
       $(document).ready(function () {
           $('#smt').click(function () {
               ajax_submit('#content', undefined, function (r) {
                   if (r.success) {

                   }
               });
           });

           $('#UploadAttachSave').combobox('setValue', '@Model.Upload.AttachSave');
           $('#UploadWatermarkType').combobox('setValue', '@Model.Upload.WatermarkType');
           $('#UploadWatermarkFont').combobox('setValue', '@Model.Upload.WatermarkFont');
           $('#UploadAttachImgIsScale').combobox('setValue', '@Model.Upload.AttachImgIsScale.ToString().ToLower()');
           $('#UploadWatermarkPosition').combobox('setValue', '@Model.Upload.WatermarkPosition');
           $('#UploadThumbnailIsScale').combobox('setValue', '@Model.Upload.ThumbnailIsScale.ToString().ToLower()');
           $('#FeatureIsPerformance').combobox('setValue', '@Model.Feature.IsPerformance.ToString().ToLower()');
           $('#FeatureIsChat').combobox('setValue', '@Model.Feature.IsChat.ToString().ToLower()'); 
           $('#FeatureIsLogHQL').combobox('setValue', '@Model.Feature.IsLogHQL.ToString().ToLower()');
           $('#RepeatLogin_' + '@Model.Feature.RepeatLogin.ToString()').attr('checked', true);
           $('#FeatureIsOpenIPBlackWhite').combobox('setValue', '@Model.Feature.IsOpenIPBlackWhite.ToString().ToLower()');
           $('#FeatureIsErrorAutoSendMail').combobox('setValue', '@Model.Feature.IsErrorAutoSendMail.ToString().ToLower()'); 

           $('#testsmtp').click(testSMTP);
       });

       function testSMTP() {
           ajax_submit('#mailsetting', '@Url.Action("TestSMTP")', function (r) {
               if (r.success) {
                   
               }
           });
       }
   </script>
   
}
@section body{
<body>
   <div class="easyui-layout" data-options="fit:true">
        <div data-options="region:'north',border:false">
            <div class="navigation">
                <div class="left">
                   @ViewBag.CurrentPath
                </div>
            </div>
            <div class="expand_margin"></div>
        </div> 
        <div id='content' data-options="region:'center',border:false" >
             <div class="easyui-tabs" data-options="plain:true,border:false,fit:true">
                <div title="功能设置">  
                    <table class="form_table">
                        <col width="180px"><col>
                        <tbody>
                        <tr>
                            <th>即时通讯：</th>
                            <td>
                                <select name="Feature.IsChat" id="FeatureIsChat" style="width:100px;" class="easyui-combobox" data-options="panelHeight:'auto'">
                                    <option Value="true" >开启</option>
                                    <option Value="false">关闭</option>
                                </select>
                                <label>*是否开启即时通讯</label>
                            </td>
                        </tr>
                        <tr>
                            <th>性能统计：</th>
                            <td>
                                <select name="Feature.IsPerformance" id="FeatureIsPerformance" style="width:100px;" class="easyui-combobox" data-options="panelHeight:'auto'">
                                    <option Value="true" >开启</option>
                                    <option Value="false">关闭</option>
                                </select>
                                <label>*是否开启性能统计</label>
                            </td>
                        </tr>
                        <tr>
                            <th>记录HQL：</th>
                            <td>
                                <select name="Feature.IsLogHQL" id="FeatureIsLogHQL" style="width:100px;" class="easyui-combobox" data-options="panelHeight:'auto'">
                                    <option Value="true" >记录</option>
                                    <option Value="false">不记录</option>
                                </select>
                                <label>*是否记录HQL</label>
                            </td>
                        </tr>
                        <tr>
                        <th>重复登陆：</th>
                            <td>
                                <span class="radiobox_midle"><input name="Feature.RepeatLogin" id="RepeatLogin_1"  type="radio" value="1" checked="checked" /><label for="RepeatLogin_1" class="defaulFont">踢出</label></span>
                                <span class="radiobox_midle"><input name="Feature.RepeatLogin" id="RepeatLogin_2" type="radio" value="2"  /><label for="RepeatLogin_2" class="defaulFont">允许</label></span>
                                <span class="radiobox_midle"><input name="Feature.RepeatLogin" id="RepeatLogin_3"  type="radio" value="3" /><label for="RepeatLogin_3" class="defaulFont">不允许</label></span>
                                <label>*是否允许重复登陆,踢出：将把之前登陆的用户下线</label>
                            </td>
                        </tr>
                        <tr>
                            <th>IP黑白名单：</th>
                            <td>
                                <select name="Feature.IsOpenIPBlackWhite" id="FeatureIsOpenIPBlackWhite" style="width:100px;" class="easyui-combobox" data-options="panelHeight:'auto'">
                                    <option Value="true" >开启</option>
                                    <option Value="false">关闭</option>
                                </select>
                                <label>*是否开启IP黑白名单</label>
                            </td>
                        </tr>
                        <tr>
                            <th>系统错误时：</th>
                            <td>
                                <select name="Feature.IsErrorAutoSendMail" id="FeatureIsErrorAutoSendMail" style="width:100px;" class="easyui-combobox" data-options="panelHeight:'auto'">
                                    <option Value="true" >发送邮件通知</option>
                                    <option Value="false">无操作</option>
                                </select>
                                <label>
                                *系统出错时是否通知相关人员
                                </label>
                                &nbsp; <a href="javascript:show_fullscreen_dialog('@Url.Action("Index","EventsNotify")?EventCode=SystemError')">通知人</a>
                                &nbsp; <a href="javascript:show_fullscreen_dialog('@Url.Action("Edit", "MailTemplate")?code=SystemError')">邮件内容</a>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
                <div title="上传设置">  
                    <table class="form_table">
                        <col width="180px"><col>
                        <tbody>
                        <tr>
                            <th>默认上传目录：</th>
                            <td>
                                <input type="text" name="Upload.AttachPath" value="@Model.Upload.AttachPath" class="easyui-validatebox" data-options="required:true" maxlength="255" />    
                                <label>*上传图片或附件的默认目录</label>
                            </td>
                        </tr>
                        <tr>
                            <th>保存方式：</th>
                            <td>
                                <select name="Upload.AttachSave" id="UploadAttachSave" class="easyui-combobox" data-options="panelHeight:'auto'">
                                    <option Value="0">存入同一目录</option>
                                    <option Value="1">按 年月日 存入不同目录</option>
                                    <option Value="2">按 年月   存入不同目录</option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <th>允许上传类型：</th>
                            <td>
                                <input type="text" name="Upload.AttachExtension" value="@Model.Upload.AttachExtension" class="easyui-validatebox" data-options="required:true" style="width:400px;" />    
                                <label>*以英文的逗号分隔开，如：“jpg,gif,rar”</label>
                            </td>
                        </tr>
                        <tr>
                            <th>文件上传大小：</th>
                            <td>
                            <input type="text" name="Upload.AttachFileSize" value="@Model.Upload.AttachFileSize" class="easyui-numberspinner smallnumber" data-options="required:true,min:0" /> KB
                                <label>*超过设置的文件大小不予上传，0不限制</label>
                            </td>
                        </tr>
                        <tr>
                            <th>图片上传大小：</th>
                            <td>
                                <input type="text" name="Upload.AttachImgSize" value="@Model.Upload.AttachImgSize" class="easyui-numberspinner smallnumber" data-options="required:true,min:0" /> KB
                                <label>*超过设置的图片大小不予上传，0不限制</label>
                            </td>
                        </tr>
                        <tr>
                            <th>保持图片宽高比：</th>
                            <td>
                                <select name="Upload.AttachImgIsScale" id="UploadAttachImgIsScale" style="width:100px;" class="easyui-combobox" data-options="panelHeight:'auto'">
                                    <option Value="true" >保持比例 </option>
                                    <option Value="false">不保持</option>
                                </select>
                                <label>* 当图片被缩小时是否保持原有比例</label>
                            </td>
                        </tr>
                        <tr>
                            <th>图片最大尺寸：</th>
                            <td>
                                <input type="text" name="Upload.AttachImgMaxWidth" value="@Model.Upload.AttachImgMaxWidth" class="easyui-numberspinner smallnumber" data-options="required:true,min:0" /> ×
                                <input type="text" name="Upload.AttachImgMaxHeight" value="@Model.Upload.AttachImgMaxHeight" class="easyui-numberspinner smallnumber" data-options="required:true,min:0" /> PX
                                <label>*设置图片宽和高，超出自动裁剪，0为不受限制</label>
                            </td>
                        </tr>
                        <tr>
                            <th>保持缩略图宽高比：</th>
                            <td>
                               <select name="Upload.ThumbnailIsScale" id="UploadThumbnailIsScale" style="width:100px;" class="easyui-combobox" data-options="panelHeight:'auto'">
                                    <option Value="true" >保持比例 </option>
                                    <option Value="false">不保持</option>
                                </select>
                                <label>* 当创建缩略图时是否保持原有比例</label>
                            </td>
                        </tr>
                        <tr>
                            <th>生成缩略图大小：</th>
                            <td>
                                <input type="text" name="Upload.ThumbnailWidth" value="@Model.Upload.ThumbnailWidth" class="easyui-numberspinner smallnumber" data-options="required:true,min:1" /> ×
                                <input type="text" name="Upload.ThumbnailHeight" value="@Model.Upload.ThumbnailHeight" class="easyui-numberspinner smallnumber" data-options="required:true,min:1" /> PX
                                <label>*图片生成缩略图最大宽和最大高</label>
                            </td>
                        </tr>
                        <tr>
                            <th>图片水印类型：</th>
                            <td> 
                                <select name="Upload.WatermarkType" id="UploadWatermarkType" style="width:100px;" class="easyui-combobox" data-options="panelHeight:'auto'">
                                    <option Value="0" >关闭水印 </option>
                                    <option Value="1">文字水印 </option>
                                    <option Value="2">图片水印 </option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <th>图片水印位置：</th>
                            <td>
                                <select id="UploadWatermarkPosition" name="Upload.WatermarkPosition" style="width:100px;" class="easyui-combobox" data-options="value:'@Model.Upload.WatermarkPosition',panelHeight:'auto'">
                                    <option Value="1">左上 </option>
                                    <option Value="2">中上 </option>
                                    <option Value="3">右上 </option>
                                    <option Value="4">左中 </option>
                                    <option Value="5">居中 </option>
                                    <option Value="6">右中 </option>
                                    <option Value="7">左下 </option>
                                    <option Value="8">中下 </option>
                                    <option Value="9">右下 </option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <th>图片生成质量：</th>
                            <td>
                               <input type="text" name="Upload.WatermarkImgQuality" value="@Model.Upload.WatermarkImgQuality" class="easyui-numberspinner smallnumber" data-options="required:true,min:0,max:100" />
                               <label>*只适用于加水印的jpeg格式图片.取值范围 0-100, 0质量最低, 100质量最高, 默认80</label>
                            </td>
                        </tr>
                        <tr>
                            <th>图片水印文件：</th>
                            <td>
                               <input type="text" name="Upload.WatermarkPic" value="@Model.Upload.WatermarkPic" class="easyui-validatebox" data-options="required:true" maxlength="255" style="width:200px;" /> 
                               <label>* 如图片不存在将使用文字水印</label>
                            </td>
                        </tr>
                        <tr>
                            <th>水印透明度：</th>
                            <td>
                                <input type="text" name="Upload.WatermarkTransparency" value="@Model.Upload.WatermarkTransparency" class="easyui-numberspinner smallnumber" data-options="required:true,min:1,max:10" />
                                <label>*取值范围1-10 (10为不透明)</label>
                            </td>
                        </tr>
                        <tr>
                            <th>水印文字：</th>
                            <td>
                                <input type="text" name="Upload.WatermarkText" value="@Model.Upload.WatermarkText" class="easyui-validatebox" data-options="required:true"/> 
                                <label>*文字水印的内容</label>
                            </td>
                        </tr>
                        <tr>
                            <th>文字字体：</th>
                            <td>
                                <select name="Upload.WatermarkFont" id="UploadWatermarkFont" class="easyui-combobox">
                                @{
                                foreach(var font in new System.Drawing.Text.InstalledFontCollection().Families)
                                {
                                    <option value="@font.Name">@font.Name</option>
                                }    
                                }
                                </select>
                                <input type="text" name="Upload.WatermarkFontSize" value="@Model.Upload.WatermarkFontSize" class="easyui-numberspinner smallnumber" data-options="required:true,min:1,max:10000" />   px
                                <label>*文字水印的字体和大小</label>
                            </td>
                        </tr>
                        </tbody>
                    </table>                            
                </div>       
                <div id="mailsetting" title="邮件设置">  
                    <table class="form_table">
                        <col width="180px"><col>
                        <tbody>
                        <tr>
                            <th>STMP服务器：</th>
                            <td>
                                <input type="text" name="Mail.SMTPServer" value="@Model.Mail.SMTPServer" class="easyui-validatebox" data-options="required:true" maxlength="100" />    
                                <label>*发送邮件的SMTP服务器地址</label>
                            </td>
                        </tr>
                        <tr>
                            <th>SMTP端口：</th>
                            <td>
                                <input type="text" name="Mail.SMTPPort" value="@Model.Mail.SMTPPort" class="easyui-numberspinner number" data-options="required:true,min:1,max:65535" />    
                                <label>*SMTP服务器的端口(1-65535)</label>
                            </td>
                        </tr>
                        <tr>
                            <th>邮箱账号：</th>
                            <td>
                                <input type="text" name="Mail.UserName" value="@Model.Mail.UserName" class="easyui-validatebox" data-options="required:true" maxlength="100" />    
                                <label>*</label>
                            </td>
                        </tr>
                        <tr>
                            <th>邮箱密码：</th>
                            <td>
                                <input type="password" name="Mail.Password" value="" class="easyui-validatebox" data-options="" maxlength="100" />    
                                <label>为空不修改原密码</label>
                            </td>
                        </tr>
                        <tr>
                            <th>发件人地址：</th>
                            <td>
                                <input type="text" name="Mail.From" value="@Model.Mail.From" class="easyui-validatebox" data-options="required:true,validType:'email'" maxlength="100" />    
                                <label>*</label>
                            </td>
                        </tr>
                        <tr>
                            <th>发件人昵称：</th>
                            <td>
                                <input type="text" name="Mail.NickName" value="@Model.Mail.NickName" class="easyui-validatebox" data-options="required:true" maxlength="100" />    
                                <label>* 显示发件人的昵称</label>
                            </td>
                        </tr>
                        <tr>
                            <th></th>
                            <td>
                                <input type="button" value="测试" id="testsmtp"  style="width:70px;" class="btnSubmit" />
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>       
            </div>
        </div>
        <div data-options="region:'south',border:false,align:'center'" style="text-align:center; height:40px;">
            <div class="hr"></div>
            <input type="submit" id="smt" value="提交保存" class="btnSubmit" />
        </div>
    </div>
</body>
}
